// 封装和文章相关的接口
import request from '@/utils/request.js'
// 获取所有频道数据
export function getChannelsService() {
  return request.get('/channels')
}

// 新增文章
export function addArticleService(data) {
  return request.post('/mp/articles?draft=false', data)
}

// 获取文章列表
export function getArticleListService(params) {
  return request.get('/mp/articles', {
    params
  })
}
// 删除文章
export function deleteArticleService(id) {
  return request.delete(`mp/articles/${id}`)
}

// 获取文章详情
export function getArticleDetailService(id) {
  return request.get(`/mp/articles/${id}`)
}

// 更新文章
export function updateArticleService(data) {
  return request.put(`/mp/articles/${data.id}?draft=false`, data)
}
